if ([System.Environment]::OSVersion.Version.Major -eq "5" )
{
  Write-Host "Not MS-Windows 7/8/10"
  Exit
}

Write-Host "Ms-Windows - Uninstall"

$uninstall64 = gci "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match "SATF TM-T900FA" } | select UninstallString

if ($uninstall64) {
$uninstall64 = $uninstall64.UninstallString
$uninstall64 = $uninstall64.Trim()

$wshell = New-Object -ComObject wscript.shell;
$wshell.run($uninstall64)
$wshell.AppActivate('SATF TM-T900FA Maintenance')
while (-not $wshell.AppActivate('SATF TM-T900FA Maintenance')) 
{
Sleep 1
$wshell.AppActivate('SATF TM-T900FA Maintenance')
}

$wshell.SendKeys('+{TAB}')
$wshell.Sendkeys('+{TAB}')
$wshell.sendkeys('{DOWN}')
$wshell.sendkeys('{TAB}')
$wshell.sendkeys('~')
}
